package com.dingding.enums;

import java.util.Arrays;

public enum ResponseCode {
    SUCCESS("0000_0", "执行成功"),
    FAILURE("0000_1", "执行失败"),
    SYS_EXCEPTION("0000_3", "系统异常"),
    ARGS_VALIDATION_ERROR("0000_4", "参数验证失败"),
    COMMON_DATA_AUTHORIZATION_FAILURE("0000_5", "无数据操作权限"),
    CAPTCH_TYPE_ERROR("0000_6", "验证码类型不正确"),
    VERIFY_CODE_EXCEED("0000_7", "短信验证码验证超过次数"),
    VERIFY_PICTURE_CAPTCH_ERROR("0000_8", "验证码不正确"),
    VERIFY_PHONE_CAPTCH_ERROR("0000_9", "短信证码不正确"),
    VERIFY_PHONE_CAPTCH_EXPIRE("0000_9_1", "验证码失效，请重新发送验证码"),
    USER_PHONE_NOT_MATCH_ERROR("0000_9_2", "手机号码与当前用户手机号不匹配"),
    SMS_TODAY_SEND_OVERFLOW("0000_10", "短信发送次数超过最大限制"),
    SMS_MINUTE_SEND_OVERFLOW("0000_11", "一分钟最多发一次短信"),
    EMAIL_TODAY_SEND_OVERFLOW("0000_12", "邮件发送次数超过最大限制"),
    EMAIL_MINUTE_SEND_OVERFLOW("0000_13", "一分钟最多发一次邮件"),
    VERIFY_EMAIL_CAPTCH_ERROR("0000_14", "邮箱验证码不正确"),
    EMAIL_NOT_EXIST_ERROR("0000_15", "邮箱不是集团统一邮箱"),
    EMAIL_PHONE_NOT_MATCH_ERROR("0000_16", "该邮箱与当前用户手机号不匹配"),
    USER_NOT_EXIST_ERROR("0000_17", "用户信息不存在"),
    USER_ROLE_NOT_MATCH_ERROR("0000_18", "用户角色不正确"),
    ARTICLE_CONTENT_TOO_LONG("0000_19", "文章内容过长"),
    ARTICLE_FILE_ERROR("0000_20", "产品方案分享匹配错误，请刷新后再试"),
    ARTICLE_FILE_NOT_EXIST("0000_21", "分享方案不存在"),
    USER_NOT_EMAIL_AUTHED("0000_22", "请先进行移动员工认证"),
    TOKEN_EXPIRE("0000_23", "token过期"),
    FILE_TYPE_EXPIRE("0000_24", "上传文件类型不支持"),
    FILE_SIZE_TOO_BIG("0000_25", "上传文件大小超过限制"),
    ;

    private String code;

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    private String message;

    private ResponseCode(final String code, final String message) {
        this.code = code;
        this.message = message;
    }

    public static ResponseCode getResponseByCode(String code) {
        return Arrays.stream(ResponseCode.values()).filter(o->o.getCode().equals(code)).findFirst().get();
    }
}
